@extends('console.common.framework') 
@section('heads')
<link rel="stylesheet" href="{{ env('APP_STATIC') }}vendor/cropper/dist/cropper.min.css">
<script>
    let commonTr = `
<tr>
        <td class="form-group">
            <input type="text" name="common_param[]" value="" placeholder="参数名" class="form-control">
        </td>
        <td class="form-group">
            <select name="common_type[]" class="form-control">
                @foreach(config('param.types') as $type)
                    <option value="{{$type}}">{{$type}}</option>
                @endforeach
            </select>
        </td>
        <td class="form-group">
            <input type="text" name="common_limited[]" value="不限" placeholder="长度" class="form-control">
        </td>
        <td class="form-group">
            <select name="common_required[]" class="form-control">
                    <option value="1" selected>是</option>
                    <option value="0">否</option>
                </select>
        </td>
        <td class="form-group">
            <input type="text" name="common_description[]" placeholder="参数描述" class="form-control">
        </td>
        <td class="form-group text-center">
            <span class="fa fa-lg fa-plus-square-o fa-action" title="新增" onclick="fnAppendCommonTr()"></span>
            <span class="fa fa-lg fa-trash-o del-span fa-action" title="删除" onclick="fnRemoveTr(this)"></span>
        </td>
    </tr>
`
let errorTr = `
<tr>
        <td class="form-group">
            <input type="text" name="error_code[]" value="" placeholder="错误代码" class="form-control">
        </td>
        <td class="form-group">
            <input type="text" name="error_title[]" value="" placeholder="错误类型" class="form-control">
        </td>
        <td class="form-group">
            <input type="text" name="error_description[]" placeholder="描述" class="form-control">
        </td>
        <td class="form-group text-center">
            <span class="fa fa-lg fa-plus-square-o fa-action" title="新增" onclick="fnAppendErrorTr()"></span>
            <span class="fa fa-lg fa-trash-o del-span fa-action" title="删除" onclick="fnRemoveTr(this)"></span>
        </td>
    </tr>
`

</script>
@endsection
 
@section('content')
<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header">项目管理</h3>
    </div>
    <!-- /.col-lg-12 -->
</div>
<!-- Nav tabs -->
<div class="row">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active">
            <a href="#basic" aria-controls="basic" role="tab" data-toggle="tab">基本信息</a>
        </li>
    </ul>
</div>
<br>
<div class="tab-content row">
    <div class="row tab-pane active" role="tabpanel" id="basic">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    项目添加
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <form role="form" id="project-form" class="project-form">
                                {{ csrf_field() }}
                                <div class="form-group col-lg-6">
                                    <label>项目名称</label>
                                    <input class="form-control" type="text" name="title" value="" placeholder="项目标题">
                                </div>
                                <div class="form-group col-lg-6">
                                    <label>vname</label>
                                    <input class="form-control" type="text" name="vname" value="" placeholder="项目唯一英文名称">
                                </div>
                                <div class="form-group col-lg-6">
                                    <label>token</label>
                                    <input class="form-control" type="text" name="token" value="" placeholder="项目口令">
                                </div>
                                <div class="form-group col-lg-6">
                                    <label>关键词</label>
                                    <input class="form-control" type="text" name="keywords" value="" placeholder="关键词多项用英文逗号隔开,用于Head">
                                </div>
                                <div class="form-group col-lg-12">
                                    <label>描述</label>
                                    <input class="form-control" type="text" name="description" value="" placeholder="项目描述信息,用于Head">
                                </div>
                                <div class="form-group col-lg-12">
                                    <div class="row">
                                        <label class="col-lg-6">项目简介（支持markdown语法）</label>
                                        <label class="col-lg-6">预览</label>
                                    </div>
                                    <div class="row">
                                        <div class="col-lg-6 col-sm-6 col-md-6">
                                            <textarea class="form-control bianji-textarea-l" id="md" rows="8" name="intro" placeholder="项目简介"></textarea>
                                        </div>
                                        <div class="col-lg-6 col-sm-6 col-md-6" id="html"></div>
                                    </div>
                                </div>
                                <div class="form-group col-lg-12">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            公共参数
                                        </div>
                                        <div class="panel-body">
                                            <table class="table table-hover" id="common-table">
                                                <thead>
                                                    <tr>
                                                        <th class="text-center col-lg-2">参数名</th>
                                                        <th class="text-center col-lg-1">类型</th>
                                                        <th class="text-center col-lg-1">长度</th>
                                                        <th class="text-center col-lg-1">是否必须</th>
                                                        <th class="text-center col-lg-5">描述</th>
                                                        <th class="text-center col-lg-2">操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td class="form-group">
                                                            <input type="text" name="common_param[]" value="" placeholder="参数名" class="form-control">
                                                        </td>
                                                        <td class="form-group">
                                                            <select name="common_type[]" class="form-control">
                                                                @foreach(config('param.types') as $type)
                                                                    <option value="{{$type}}">{{$type}}</option>
                                                                @endforeach
                                                            </select>
                                                        </td>
                                                        <td class="form-group">
                                                            <input type="text" name="common_limited[]" value="不限" placeholder="长度" class="form-control">
                                                        </td>
                                                        <td class="form-group">
                                                            <select name="common_required[]" class="form-control">
                                                                    <option value="1" selected>是</option>
                                                                    <option value="0">否</option>
                                                                </select>
                                                        </td>
                                                        <td class="form-group">
                                                            <input type="text" name="common_description[]" placeholder="参数描述" class="form-control">
                                                        </td>
                                                        <td class="form-group text-center">
                                                            <span class="fa fa-lg fa-plus-square-o fa-action" title="新增" onclick="fnAppendCommonTr()"></span>
                                                            <span class="fa fa-lg fa-trash-o del-span fa-action" title="删除" onclick="fnRemoveTr(this)"></span>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group col-lg-12">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            错误码
                                        </div>
                                        <div class="panel-body">
                                            <table class="table table-hover" id="error-table">
                                                <thead>
                                                    <tr>
                                                        <th class="text-center col-lg-2">错误代码</th>
                                                        <th class="text-center col-lg-2">错误类型</th>
                                                        <th class="text-center col-lg-6">描述</th>
                                                        <th class="text-center col-lg-2">操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td class="form-group">
                                                            <input type="text" name="error_code[]" value="" placeholder="错误代码" class="form-control">
                                                        </td>
                                                        <td class="form-group">
                                                            <input type="text" name="error_title[]" value="" placeholder="错误类型" class="form-control">
                                                        </td>
                                                        <td class="form-group">
                                                            <input type="text" name="error_description[]" placeholder="描述" class="form-control">
                                                        </td>
                                                        <td class="form-group text-center">
                                                            <span class="fa fa-lg fa-plus-square-o fa-action" title="新增" onclick="fnAppendErrorTr()"></span>
                                                            <span class="fa fa-lg fa-trash-o del-span fa-action" title="删除" onclick="fnRemoveTr(this)"></span>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group col-lg-12">
                                    <label>图片</label>
                                    <input name="img" type="file" accept="image/gif,image/jpeg,image/png">
                                </div>
                                <div class="form-group form-cropper col-lg-6" style="display:none;">
                                    <label>裁剪</label>
                                    <img src="" alt="" id="image" style="display:none;">
                                </div>
                                <div class="form-group form-preview col-lg-6" style="display:none;">
                                    <label>预览</label>
                                    <div class="img-preview project-preview-lg"></div>
                                </div>
                                <div class="form-group form-cropper-control col-lg-12" style="display:none;">
                                    <button type="button" class="btn btn-primary btn-circle" onclick="cropimg.cropper('zoom',0.1)"><i class="fa fa-search-plus" ></i>
                                            </button>
                                    <button type="button" class="btn btn-primary btn-circle" onclick="cropimg.cropper('zoom',-0.1)"><i class="fa fa-search-minus" ></i>
                                            </button> &nbsp;&nbsp;
                                    <button type="button" class="btn btn-info btn-circle" onclick="cropimg.cropper('move',-10,0)"><i class="fa fa-arrow-left" ></i>
                                            </button>
                                    <button type="button" class="btn btn-info btn-circle" onclick="cropimg.cropper('move',10,0)"><i class="fa fa-arrow-right" ></i>
                                            </button>
                                    <button type="button" class="btn btn-info btn-circle" onclick="cropimg.cropper('move',0,-10)"><i class="fa fa-arrow-up" ></i>
                                            </button>
                                    <button type="button" class="btn btn-info btn-circle" onclick="cropimg.cropper('move',0,10)"><i class="fa fa-arrow-down" ></i>
                                            </button> &nbsp;&nbsp;
                                    <button type="button" class="btn btn-success btn-circle" onclick="cropimg.cropper('rotate',-5)"><i class="fa fa-rotate-left" ></i>
                                            </button>
                                    <button type="button" class="btn btn-success btn-circle" onclick="cropimg.cropper('rotate',5)"><i class="fa fa-rotate-right" ></i>
                                            </button> &nbsp;&nbsp;
                                    <button type="button" class="btn btn-warning btn-circle" onclick="scaleX *= -1;cropimg.cropper('scaleX',scaleX)"><i class="fa fa-arrows-h" ></i>
                                            </button>
                                    <button type="button" class="btn btn-warning btn-circle" onclick="scaleY *= -1;;cropimg.cropper('scaleY',scaleY)"><i class="fa fa-arrows-v" ></i>
                                            </button> &nbsp;&nbsp;
                                    <button type="button" class="btn btn-danger btn-circle" onclick="cropimg.cropper('reset')"><i class="fa fa-refresh"></i>
                                            </button>
                                </div>
                                <div class="form-group col-lg-6">
                                    <label>排序</label>
                                    <input class="form-control" type="number" name="rank" value="0" placeholder="">
                                </div>
                                <div class="form-group col-lg-12">
                                    <label style="margin-right:25px;">项目状态</label>
                                    <label class="radio-inline">
                                                <input type="radio" name="status" value="1" checked>显示
                                            </label>
                                    <label class="radio-inline">
                                                <input type="radio" name="status" value="0">隐藏
                                            </label>
                                </div>
                                <div class="form-group col-lg-12">
                                    <button type="button" class="btn btn-primary submit">提交</button>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- /.table-responsive -->
                </div>
                <!-- /.panel-body -->
            </div>
            <!-- /.panel -->
        </div>
    </div>
</div>
@endsection
 
@section('scripts')
<script src="{{ env('APP_STATIC') }}vendor/cropper/dist/cropper.min.js"></script>
<script src="{{ env('APP_STATIC') }}console/js/project.js"></script>
@endsection